package com.qf.day12.homework;

import java.util.HashMap;
import java.util.Map;

public class CharacterCount {
    public static void main(String[] args) {
        String inputString = "hello word nice to meet you you you you";

        Map<Character, Integer> characterCountMap = new HashMap<>();

        for (char c : inputString.toCharArray()) {
            characterCountMap.put(c, characterCountMap.getOrDefault(c, 0) + 1);
        }

        for (Map.Entry<Character, Integer> entry : characterCountMap.entrySet()) {
            System.out.println("字符: " + entry.getKey() + " 出现次数: " + entry.getValue());
        }
    }
}
